
import type { ReactElement } from "react"
import QuestionInput from "../components/editComponents/commpoent/input/questionInput"
import QuestionTitle from "../components/editComponents/commpoent/title/questionTitle"
import type { questionComponentType } from "./type"
import QuestionParagraph from "@/components/editComponents/commpoent/paragraph/questionParagraph"
import QuestionInfo from "@/components/editComponents/commpoent/info/questionInfo"
import QuestionTextarea from "@/components/editComponents/commpoent/textarea/questionTextarea"
import QuestionRadio from "@/components/editComponents/commpoent/radio/questionRadio"
import { defaultCheckboxProps, defaultInfoProps, defaultInputProps, defaultParagraphProps, defaultRadioProps, defaultTextareaProps, defaultTitleProps } from "./default"
import QuestionCheckbox from "@/components/editComponents/commpoent/checkbox/questionCheckbox"



export type componentsType = {
  component: ReactElement<any, any>
  componentConfig: questionComponentType
}

export type ComponentType = {
  groupId: string,
  groupName: string,
  components: Array<componentsType>
}

export const componentLibList: ComponentType[] = [
  {
    groupId: "textGroup",
    groupName: "文本显示",
    components: [
      {
        component: <QuestionInfo />,
        componentConfig: {
          fe_id: '12345',
          type: "questionInfo",
          title: "信息",
          isHidden: false,
          isLocked: false,
          props:defaultInfoProps
        }
      },
      {
        component: <QuestionTitle />,
        componentConfig:
        {
          fe_id: '123',
          type: "questionTitle",
          title: "标题",
          isHidden: false,
          isLocked: false,
          props:defaultTitleProps
        }

      },
      {
        component: <QuestionParagraph />,
        componentConfig: {
          fe_id: '1234',
          type: "questionParagraph",
          title: "段落",
          isHidden: false,
          isLocked: false,
          props:defaultParagraphProps
        }
      },
      
    ],

  },
  {
    groupId: "inputGroup",
    groupName: "用户输入",
    components: [
      {
        component: <QuestionInput />,
        componentConfig:
        {
          fe_id: '666',
          type: "questionInput",
          title: "单行文本输入框",
          isHidden: false,
          isLocked: false,
          props:defaultInputProps
        }

      },
      {
        component: <QuestionTextarea />,
        componentConfig: {
          fe_id: '777',
          type: "questionTextarea",
          title: "多行文本输入框",
          isHidden: false,
          isLocked: false,
          props: defaultTextareaProps
        }
      }
    ],
  },
  {
    groupId: "chooseGroup",
    groupName: "用户选择",
    components: [
      {
        component: <QuestionRadio />,
        componentConfig: {
          fe_id: '888',
          type: "questionRadio",
          title: "单选框",
          isHidden: false,
          isLocked: false,
          props: defaultRadioProps
        }
      },
      {
        component: <QuestionCheckbox />,
        componentConfig: {
          fe_id: '999',
          type: "questionCheckbox",
          title: "多选框",
          isHidden: false,
          isLocked: false,
          props: defaultCheckboxProps
        }
      }
    ]
  }
]
